/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.rhythm.commons.net.messaging;

import com.rhythm.commons.net.NetUtil;

/**
 *
 * @author Michael J. Lee
 */
public enum SMSProvider {

    ATT_WIRELESS("ATT&T Wireless", "txt.att.net"),
    BELL_MOBILITY("Bell Mobility", "txt.bellmobility.ca"),
    CINGULAR("Cingular", "mobile.mycingular.com"),
    FIDO("Fido", "fido.ca"),
    NEXTEL("Nextel", "messaging.nextel.com"),
    SPRINT_PCS("Sprint PCS", "messaging.sprintpcs.com"),
    VERIZON_WIRELESS("Verizon Wireless", "vtext.com"),
    US_CELLULAR("U.S. Cellular", "email.uscc.net"),
    VOICESTREAM("Voicestream", "tmomail.net"),
    ROGERS_ATT("Rogers AT&T", "pcs.rogers.com"),
    TELUS("Telus", "msg.telus.com"),
    T_MOBILE("T-Mobile", "t-mobile.com"),
    ALLTEL("Alltel", "message.alltel.com"),
    CELLULARONE("CellularOne", "mobile.celloneusa.com"),
    COMCAST("Comcast", "comcast.com");

    private final String name;
    private final String address;
    private final String AT = "@";
    private final static int DEFAULT_TIMEOUT = 1000;

    private SMSProvider(String name,String address){
        this.name = name;
        this.address = address;
    }

    /**
     * Returns the name of the SMS provider
     * @return
     */
    public final String getName(){
        return name;
    }

    /**
     * Returns the smtp address for the SMS provider
     * @return
     */
    public final String getAddress(){
        return address;
    }

    /**
     * Attempts to connect to the provider
     * @return
     */
    public boolean canConnect(){
        return NetUtil.ping(address, DEFAULT_TIMEOUT).wasSuccessful();
    }
}
